<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 //载入正则表达式 常量
require_once APPPATH.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'reg.php';
class MY_Controller extends CI_Controller {
        /*
         * 保存一些全局变量
         */
        public $G;
        //加密函数字符串
        const ENCODE = 'dsa45sda465sda465sda4f21asdf65adsf4';
	/**
	 * 自定义控制器
	 *
	 */
	public function __construct()
	{
		parent::__construct();
                date_default_timezone_set("Etc/GMT");
                $this->G = new stdClass;
		$this->G->system  = new stdClass;
		//***配置用户***/
                $this->G->user = new stdClass;
                $this->G->user->login = false;
		$this->G->user->order_count = 0;
		/********配置cookie*********/
		$this->G->cookie = new stdClass;
                if(!class_exists('Redis'))
                {
                    //exit('Redis Not installed');
                }
                $this->load->driver('cache');  //载入缓存
                
		$this->_init();
	}

	/*
	 * 初始化系统数据
	 */
	public function _init()
	{
		$this->load->model('system_model');
		$t = $this->cache->get('system_data');
		if($t)
                {
                   $this->G->system = unserialize($t);
                }
		else
		{
			$t_var = $this->system_model->lists();
			foreach($t_var as $item)
			{
				$this->G->system->{$item->title} = $item->content;
			}
			$this->cache->save('system_data', serialize($this->G->system), 360000);
		}
	}
}

require_once('controller'.DIRECTORY_SEPARATOR.'JS_Controller.php');
require_once('controller'.DIRECTORY_SEPARATOR.'CSS_Controller.php');
require_once('controller'.DIRECTORY_SEPARATOR.'XML_Controller.php');
require_once('controller'.DIRECTORY_SEPARATOR.'CLI_Controller.php');
require_once('controller'.DIRECTORY_SEPARATOR.'Http_Controller.php');
require_once('controller'.DIRECTORY_SEPARATOR.'Admin_Controller.php');
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
